﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using Bon_It.Model;
using Bonit_It.ViewModel.Base;
using Bonit_It.ViewModel.MasterData;

namespace Bonit_It.ViewModel
{
    public partial class MainViewModel
    {

        private void AssignCommands()
        {
            UserCreateCommand = new RelayCommand(OnCreateUser, CanAddUser);
            ShowAllUsersCommand  = new RelayCommand(OnShowAllUsers, CanShowAllUsers);
            ShowAllComodityGroups = new RelayCommand(OnShowAllComodityGroups, CanShowAllComodityGroups);
            AllArticleCommand  = new RelayCommand(OnAllArticle, CanAllArticle);
        }

        public ICommand ShowAllComodityGroups { get; set; }

        public ICommand UserCreateCommand { get; set; }

        public ICommand ShowAllUsersCommand { get; set; }
        
        public ICommand AllArticleCommand { get; set; }


        public bool CanShowAllComodityGroups(object argument)
        {
            return true;
        }

        public bool CanAddUser(object argument)
        {
            return true;
        }

        public bool CanShowAllUsers(object argument)
        {
            return true;
        }

        public bool CanAllArticle(object argument)
        {
            return true;
        }

        public void OnAllArticle(object arrgument)
        {
            AllArticleViewModel model = new AllArticleViewModel();
            WorkSpaces.Add(model);
            this.SetActiveWorkspace(model);

        }
        
        
        public void OnShowAllComodityGroups(object arrgument)
        {
            ComodityGroupsViewModel model = new ComodityGroupsViewModel();
            WorkSpaces.Add(model);
            this.SetActiveWorkspace(model);

        }
        
        public void OnCreateUser(object arrgument)
        {
            Users user = new Users();
            user.UserName = "test";
            UserViewModel model = new UserViewModel(user);
            WorkSpaces.Add(model);
            this.SetActiveWorkspace(model);

        }
        public void OnShowAllUsers(object arrgument)
        {
            AllUserViewModel model = new AllUserViewModel();
            if (!WorkSpaces.Contains(model))
            {
                WorkSpaces.Add(model);
            }
            else
            {

            }
            this.SetActiveWorkspace(model);

        }
    }
}
